    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="metallic_grid_top_table" >
        <tr>
            <td>
                <div class="metallic_grid_title">Existing files</div>
            </td>
        </tr>
        <tr>
            <td class="metallic_paginator">
                <form action="admin/modules/tangra_cms/ci/ci_attachment_select.php" method="get">
                <table border="0" cellspacing="0" cellpadding="4">
                    <tr>
                        <td valign="middle"><strong>Filter</strong>&nbsp;&nbsp;&nbsp;
                        </td>
                        <td>
                            <table border="0" cellspacing="0" cellpadding="4" align="left">
                                <tr>
                                    <td>File name like:</td>
                                    <td><input name="filename" type="text" size="45" maxlength="255" value="{$filename}"/>&nbsp;&nbsp;</td>
                                </tr>
                                <tr>
                                    <td>Note like:</td>
                                    <td><input name="note" type="text" size="45" maxlength="255" value="{$note}"/>&nbsp;&nbsp;</td>                                    
                                </tr>
                            </table>                        
                        </td>
                        <td valign="middle"><input name="submit_filter" type="submit" value="filter" /></td>
                    </tr>
                </table>
                <input type="hidden" name="ci" value="{$ci_id}" />
                </form>
            </td>
        </tr>        
        
        <tr>
            <td>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="metallic_paginator">
                    <tr>
                        <td width="34%"> {if $ci_attachment_select_total_pages > 1}
                            <table border="0" cellspacing="0" cellpadding="2" class="metallic_pg_page_of_table">
                                <tr>
                                    <td valign="middle">{if $ci_attachment_select_first_page}<a href="{$ci_attachment_select_first_page}" onclick="submit_ajax_grid_ci_attachment_select({$ci_attachment_select_first_page_num}); return false;"><img src="img/modules/grid_html_tpl_static_ajax_metallic/page_first_blue.png" alt="First page" border="0" /></a>{else}<img src="img/modules/grid_html_tpl_static_ajax_metallic/page_first.png" alt="First page" border="0" />{/if}</td>
                                    <td valign="middle">{if $ci_attachment_select_prev_page}<a href="{$ci_attachment_select_prev_page}" onclick="submit_ajax_grid_ci_attachment_select({$ci_attachment_select_prev_page_num}); return false;"><img src="img/modules/grid_html_tpl_static_ajax_metallic/page_prev_blue.png" alt="Previous page" border="0" /></a>{else}<img src="img/modules/grid_html_tpl_static_ajax_metallic/page_prev.png" alt="Previous page" border="0" />{/if}</td>
                                    <td class="metallic_pg_page_of" valign="middle">{if $ci_attachment_select_total_pages}Page {$ci_attachment_select_current_page} of {$ci_attachment_select_total_pages}{/if}</td>
                                    <td valign="middle">{if $ci_attachment_select_next_page}<a href="{$ci_attachment_select_next_page}" onclick="submit_ajax_grid_ci_attachment_select({$ci_attachment_select_next_page_num}); return false;"><img src="img/modules/grid_html_tpl_static_ajax_metallic/page_next_blue.png" alt="Next page" border="0" /></a>{else}<img src="img/modules/grid_html_tpl_static_ajax_metallic/page_next.png" alt="Next page" border="0" />{/if}</td>
                                    <td valign="middle">{if $ci_attachment_select_last_page}<a href="{$ci_attachment_select_last_page}" onclick="submit_ajax_grid_ci_attachment_select({$ci_attachment_select_last_page_num}); return false;"><img src="img/modules/grid_html_tpl_static_ajax_metallic/page_last_blue.png" alt="Last page" border="0" /></a>{else}<img src="img/modules/grid_html_tpl_static_ajax_metallic/page_last.png" alt="Last page" border="0" />{/if}</td>
                                </tr>
                            </table>
                            {/if} </td>
                        <td class="metallic_pg_jump_to_page" width="33%" align="center">{if $ci_attachment_select_records_to} Records {$ci_attachment_select_records_from}-{$ci_attachment_select_records_to} of {$ci_attachment_select_records_total}{/if}</td>
                        <td class="metallic_pg_records" width="33%" align="right"> {if $ci_attachment_select_total_pages > 1}
                            <table border="0" cellspacing="2" cellpadding="0">
                                <tr>
                                    <td>Jump to page</td>
                                    <td>
                                        <form class="metallic_pg_page_select" action="{$ci_attachment_select_jump_to_page_action}" method="get" enctype="application/x-www-form-urlencoded">
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td>
                                                        <select name="ci_attachment_select_grid_page" id="ci_attachment_select_field_page" onchange="ci_attachment_select_page_change(this.options[this.selectedIndex].value); return false;">

															{foreach from=$ci_attachment_select_jump_to_page_arr item=ci_attachment_select_page_num}

                                                            <option value="{$ci_attachment_select_page_num}"{if $ci_attachment_select_page_num == $ci_attachment_select_current_page} selected="selected"{/if}>{$ci_attachment_select_page_num}</option>

															{/foreach}

                                                        </select>
                                                    </td>
                                                    <td>
                                                        <noscript>
                                                        &nbsp;
                                                        <input name="submit" type="image" src="img/modules/grid_html_tpl_static_ajax_metallic/page_go.png" alt="go" />
                                                        </noscript>
                                                    </td>
                                                </tr>
                                            </table>
                                        </form>
                                    </td>
                                </tr>
                            </table>
                            {else}
                            &nbsp;
                            {/if} </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%"  border="0" cellspacing="1" cellpadding="2" class="metallic_grid_table">
                    <thead>
                        <tr>
                            <th align="center" class="metallic_grid_header" nowrap="nowrap" width="40">&nbsp;ID&nbsp;</th>
                            <th class="metallic_grid_header" width="16"><img src="/img/modules/tangra_cms/spacer.gif" alt="spacer" width="16" height="1" /></th>
                            <th class="metallic_grid_header" width="16"><img src="/img/modules/tangra_cms/spacer.gif" alt="spacer" width="16" height="1" /></th>
                            <th align="left" class="metallic_grid_header" nowrap="nowrap" width="40%">&nbsp;Original filename&nbsp;</th>
                            <th align="right" class="metallic_grid_header" nowrap="nowrap" width="10%">&nbsp;Size&nbsp;</th>
                            <th align="left" class="metallic_grid_header" nowrap="nowrap" width="50%">&nbsp;Note&nbsp;</th>
                            <th class="metallic_grid_header">&nbsp;</th>
                        </tr>
                    </thead>
                    <tbody>

                    {foreach from=$ci_attachment_select_prows item=row}
                    <tr class="{if $row.cols.5}status_selected{else}metallic_grid_body{/if}" onmouseover="this.className='metallic_grid_body_over';return true;" onmouseout="this.className='{if $row.cols.5}status_selected{else}metallic_grid_body{/if}';return true;">
                        <td align="right">{$row.cols.0}</td>
						<td width="16">
                            {if !$row.cols.5}
                        	<a href="admin/modules/tangra_cms/ci/ci_attachment_select.php?select={$row.cols.0}&amp;ci={$ci_id}" {popup text="Attach this file"}><img src="/img/modules/crystal_icons_small/16x16/attach.png" alt="Attach" width="16" height="16" border="0"/></a>
                            {else}
                            &nbsp;
                            {/if}
                        </td>
                        <td width="16">
	                        {if $row.cols.5}
                        	<a href="admin/modules/tangra_cms/ci/ci_attachment_select.php?deselect={$row.cols.5}&amp;ci={$ci_id}" {popup text="Deattach this file"}><img src="/img/modules/crystal_icons_small/16x16/attachment_delete.png" alt="deattach" width="16" height="16" border="0"/></a>
							{/if}
                        </td>
                        <td align="left">{$row.cols.1}</td>
                        <td align="right">{$row.cols.2/1024|string_format:"%.2f"} KiB</td>
                        <td align="left">
	                            {if $row.cols.4}{$row.cols.4|truncate}{else}<span class="no_value">-- N/A --</span>{/if}
                        </td>
                        <td align="center"><a href="admin/modules/tangra_cms/attachment/attachment_download.php?fileid={$row.lc_vals.fileid}" {popup text="View / download this file"}><img src="/img/modules/crystal_icons_small/16x16/view.png" alt="delete" width="16" height="16" border="0"/></a></td>
                    </tr>
                    {foreachelse}
                    <tr class="metallic_grid_body">
                        <td colspan="7" align="left">No items</td>
                    </tr>
                    {assign var="$ci_attachment_select_prows_count"  value=1}
                    {/foreach}
				{math equation="$ci_attachment_select_page_size - rc" rc=$ci_attachment_select_prows_count assign=rc}
				{section name=aa loop=$rc}
				<tr class="metallic_grid_body">
                    <td colspan="7">&nbsp;</td>
									</tr>
				{/section}
                    </tbody>

                </table>
            </td>
        </tr>
        <tr>
            <td>
                <table width="100%" border="0" cellspacing="0" cellpadding="0" class="metallic_paginator">
                    <tr>
                        <td width="34%"> {if $ci_attachment_select_total_pages > 1}
                            <table border="0" cellspacing="0" cellpadding="2" class="metallic_pg_page_of_table">
                                <tr>
                                    <td valign="middle">{if $ci_attachment_select_first_page}<a href="{$ci_attachment_select_first_page}" onclick="submit_ajax_grid_ci_attachment_select({$ci_attachment_select_first_page_num}); return false;"><img src="img/modules/grid_html_tpl_static_ajax_metallic/page_first_blue.png" alt="First page" border="0" /></a>{else}<img src="img/modules/grid_html_tpl_static_ajax_metallic/page_first.png" alt="First page" border="0" />{/if}</td>
                                    <td valign="middle">{if $ci_attachment_select_prev_page}<a href="{$ci_attachment_select_prev_page}" onclick="submit_ajax_grid_ci_attachment_select({$ci_attachment_select_prev_page_num}); return false;"><img src="img/modules/grid_html_tpl_static_ajax_metallic/page_prev_blue.png" alt="Previous page" border="0" /></a>{else}<img src="img/modules/grid_html_tpl_static_ajax_metallic/page_prev.png" alt="Previous page" border="0" />{/if}</td>
                                    <td class="metallic_pg_page_of" valign="middle">{if $ci_attachment_select_total_pages}Page {$ci_attachment_select_current_page} of {$ci_attachment_select_total_pages}{/if}</td>
                                    <td valign="middle">{if $ci_attachment_select_next_page}<a href="{$ci_attachment_select_next_page}" onclick="submit_ajax_grid_ci_attachment_select({$ci_attachment_select_next_page_num}); return false;"><img src="img/modules/grid_html_tpl_static_ajax_metallic/page_next_blue.png" alt="Next page" border="0" /></a>{else}<img src="img/modules/grid_html_tpl_static_ajax_metallic/page_next.png" alt="Next page" border="0" />{/if}</td>
                                    <td valign="middle">{if $ci_attachment_select_last_page}<a href="{$ci_attachment_select_last_page}" onclick="submit_ajax_grid_ci_attachment_select({$ci_attachment_select_last_page_num}); return false;"><img src="img/modules/grid_html_tpl_static_ajax_metallic/page_last_blue.png" alt="Last page" border="0" /></a>{else}<img src="img/modules/grid_html_tpl_static_ajax_metallic/page_last.png" alt="Last page" border="0" />{/if}</td>
                                </tr>
                            </table>
                            {/if} </td>
                        <td class="metallic_pg_jump_to_page" width="33%" align="center">{if $ci_attachment_select_records_to} Records {$ci_attachment_select_records_from}-{$ci_attachment_select_records_to} of {$ci_attachment_select_records_total}{/if}</td>
                        <td class="metallic_pg_records" width="33%" align="right"> {if $ci_attachment_select_total_pages > 1}
                            <table border="0" cellspacing="2" cellpadding="0">
                                <tr>
                                    <td>Jump to page</td>
                                    <td>
                                        <form action="{$ci_attachment_select_jump_to_page_action}" method="get" enctype="application/x-www-form-urlencoded">
                                            <table width="100%" border="0" cellspacing="0" cellpadding="0">
                                                <tr>
                                                    <td>
                                                        <select name="ci_attachment_select_grid_page" id="ci_attachment_select_field_page" onchange="ci_attachment_select_page_change(this.options[this.selectedIndex].value); return false;">

															{foreach from=$ci_attachment_select_jump_to_page_arr item=ci_attachment_select_page_num}

                                                            <option value="{$ci_attachment_select_page_num}"{if $ci_attachment_select_page_num == $ci_attachment_select_current_page} selected="selected"{/if}>{$ci_attachment_select_page_num}</option>

															{/foreach}

                                                        </select>
                                                    </td>
                                                    <td>
                                                        <noscript>
                                                        &nbsp;
                                                        <input name="submit" type="image" src="img/modules/grid_html_tpl_static_ajax_metallic/page_go.png" alt="go" />
                                                        </noscript>
                                                    </td>
                                                </tr>
                                            </table>
                                        </form>
                                    </td>
                                </tr>
                            </table>
                            {else}
                            &nbsp;
                            {/if} </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>